﻿//import flash.geom.Point;
import flash.geom.Matrix;
class com.embedchat.skins.standart.scrollbar.ScrollBarTrackClass extends MovieClip{
	static var instanceName:String = new String ("ScrollBarTrackClass");
	static var instanceOwner:Object = com.embedchat.skins.standart.scrollbar.ScrollBarTrackClass;
	[Inspectable(name="Scroll track direction", defaultValue="vertical",type:String, enumeration="vertical,horizontal")]
	public var direction:String;
	[Inspectable(name="Scroll track width",defaultValue=17,type:Number)]
	public var canvasWidth:Number;
	[Inspectable(name="Scroll track height",defaultValue=50,type:Number)]	
	public var canvasHeight:Number;

	function ScrollBarTrackClass(){
		this.drawCanvas();
	}
	
	private function drawCanvas():Void{
		var fillType:String = "linear"
		var colors:Array = [0xE4EFFF,0xFFFFFF];
		var alphas:Array = [100, 100];
		var ratios:Array = [0x00, 0xFF];
		var rotation:Number = (this.direction == "vertical")?(0*Math.PI):(0.5*Math.PI);		
		var matrix:Matrix = new Matrix();

		matrix.createGradientBox(this.canvasWidth, this.canvasHeight, rotation, 0, 0);
		var spreadMethod:String = "pad";
		
		this.lineStyle(0, 0xD8E9FF, 100, true, "none", "round", "miter", 1);	
		this.beginGradientFill(fillType, colors, alphas, ratios, matrix, spreadMethod); 
		this.drawRectangle();
		this.endFill();

	}
	
	private function drawRectangle():Void{
		this.moveTo(0, 0);
		this.lineTo(this.canvasWidth, 0);
		this.lineTo(this.canvasWidth, this.canvasHeight);
		this.lineTo(0, this.canvasHeight);
		this.lineTo(0, 0);		
	}
}